﻿//=============================================================
// Copyright (C) 2011 深圳市中旭企业管理股份有限公司
// 作 者：曾洋
// 日 期：2011-12-14
// 描 述: 知识下载
//
// 版 本：1.00
// 修改历史纪录
// 版 本  修改时间      修改人            修改内容
// 1.00   2011/11/23   曾洋           
//=============================================================
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using ZX.Web.UI.Controls;
using ZX.BLL.Extend;
using ZX.DBModule;
using ZX.TR.Bussiness;
using ZX.TR.Library;

namespace ZX.WebApp.TR
{
    public partial class EditActivityPlan : BasePage
    {
        public string sizeStr = "";  //知识大小 
        public string dateStr = ""; //上传日期 
        public string contentStr = ""; //知识简介  
        public string addressStr = "";  //下载 
        public string nameStr = ""; //知识名称 
        public bool blShow = false;

        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                AttachListLoad();
            }
        }
        /// <summary>
        /// 获取知识列表
        /// </summary>
        private void AttachListLoad()
        {
            if (Request["id"] != null)
            {
                BTrAttach bta = new BTrAttach();
                TrAttach ta = new TrAttach();
                ta = bta.GetEntityById(Request["id"]) as TrAttach;
                if (ta != null)
                {
                    blShow = true;
                    sizeStr = ta.TrSize;
                    dateStr = ta.UploadTime.ToLongDateString();
                    contentStr = ta.Explain;
                    addressStr = ta.Address;
                    nameStr = ta.AttachName;
                }
            }
        }
        /// <summary>
        /// 截取部分字符串
        /// </summary>
        /// <param name="obj">被截取对象</param>
        /// <returns></returns>
        protected string GetSubStr(object obj)
        {
            string returnStr = "";
            if (obj!=null)
            {
                if (obj.ToString().Length > 20)
                {
                    returnStr = obj.ToString().Substring(0, 18) + "...";
                }
                else returnStr = obj.ToString();
            }
            return returnStr;
        }
    }
}